void Init(void){
	//开启时钟
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO |RCC_APB2Periph_USART1,ENABLE);
	
	//PB6设置为复用型推挽输出模式(因为PB6这个是Tx),PB7设置为浮空输入模式(因为PB7是Rx)
	GPIO_InitTypeDef GPIO_Struct;
	GPIO_Struct.GPIO_Pin = GPIO_Pin_6;
	GPIO_Struct.GPIO_Mode = GPIO_Mode_AF_PP;
	GPIO_Struct.GPIO_Speed = GPIO_Speed_2MHz;
	GPIO_Init(GPIOB,&GPIO_Struct);
	
	GPIO_Struct.GPIO_Pin = GPIO_Pin_7;
	GPIO_Struct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
	GPIO_Init(GPIOB,&GPIO_Struct);
	
	//映射(重定义)
	GPIO_PinRemapConfig(GPIO_Remap_USART1,ENABLE);
	
	//初始化USART1
	USART_InitTypeDef USART_Struct;
	USART_Struct.USART_BaudRate = 115200;
	USART_Struct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
	USART_Struct.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
	//奇偶校验
	USART_Struct.USART_Parity = USART_Parity_No;
	USART_Struct.USART_StopBits = USART_StopBits_1;
	USART_Struct.USART_WordLength = USART_WordLength_8b;
	USART_Init(USART1,&USART_Struct);
	
	USART_Cmd(USART1,ENABLE);
	//使能USART1接收中断。
	USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
	
	//初始化NVIC外设。
	NVIC_InitTypeDef NVIC_Struct;
	NVIC_Struct.NVIC_IRQChannel = USART1_IRQn;
	NVIC_Struct.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Struct.NVIC_IRQChannelPreemptionPriority = 0;
	NVIC_Struct.NVIC_IRQChannelSubPriority = 0;
	NVIC_Init(&NVIC_Struct);
}